﻿namespace Gol.Domain
{
    internal class ExtendedCell
    {
        public Cell[,] Cells { get; private set; }
     
        public ExtendedCell()
        {
            Cells = new Cell[3, 3];
            for (int i = 0; i < Cells.GetLength(0); i++)
            {
                for (int j = 0; j < Cells.GetLength(1); j++)
                {
                    Cells[i, j] = new Cell();
                }
            }
        }

        public int NumberOfneighbours()
        {
            int n=0;
            for (int i = 0; i < Cells.GetLength(0); i++)
            {
                for (int j = 0; j < Cells.GetLength(1); j++)
                {
                    if (i == 1 & j == 1)
                    {
                        //skip
                    }
                    else
                    {
                        if (Cells[i, j].IsAlive)
                        {
                            n = n + 1;
                        }
                    }
                 
                }

              
            }
            return n;
        }
    }
}